from sklearn.metrics import accuracy_score, recall_score, roc_auc_score

def compute_metrics(gt_labels, pred_maps):
    # 将预测图转化为二值化掩码
    pred_labels = pred_maps.flatten()
    gt_labels = gt_labels.flatten()

    # 计算准确率
    acc = accuracy_score(gt_labels, pred_labels)

    # 计算召回率
    recall = recall_score(gt_labels, pred_labels)

    # 计算 AUC
    auc = roc_auc_score(gt_labels, pred_labels)

    return acc, recall, auc
